--[[ 编码: WMS-05-04 名称: 逻辑库区-触发存储量重置 作者:HAN 日期:2025-1-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: TrigResetZoneStorage 更改记录: --]] json = require ("json") mobox = require ("OILua_JavelinExt") m3 = require("oi_base_mobox") function TrigResetZoneStorage ( strLuaDEID ) local nRet, strRetInfo -- 获取当前操作选中的Zone对象 -- step1 获取输入参数(场景参数) nRet, strRetInfo = mobox.getInputParameter2( strLuaDEID ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取 WMS-05-04 场景参数失败! "..strRetInfo ) end local strDataJson = '' lua.Debug( strLuaDEID, debug.getinfo(1), "getInputParameter2", strRetInfo ) if ( strRetInfo ~= '' ) then local selected_row, success success, selected_row = pcall( json.decode, strRetInfo) if ( success == false ) then lua.Error( strLuaDEID, debug.getinfo(1), "WMS-05-04 场景参数是非法的JSON格式!"..selected_row ) end -- 如果是单选 -- 从选中的数据行信息中获取逻辑库区编码 local nRow, nRowCount local n, nCount local attrs local strZoneCode nRowCount = #selected_row for nRow = 1, nRowCount do attrs = selected_row[nRow].attrs strZoneCode = '' nCount = #attrs for n = 1, nCount do if (attrs[n].attr == 'S_CODE') then strZoneCode = attrs[n].value break end end if (strZoneCode == '') then lua.Error( strLuaDEID, debug.getinfo(1), "Grid中没显示逻辑库区编码字段!" ) end strDataJson = strDataJson..'"'..strZoneCode..'",' end strDataJson = lua.trim_laster_char( strDataJson ) end strDataJson = '['..strDataJson..']' lua.Debug( strLuaDEID, debug.getinfo(1), "addSysWFP", strDataJson ) -- 加一个后台处理脚本,strDataJson 是这个脚本的输入参数 nRet, strRetInfo = mobox.addSysWFP( strLuaDEID, 1, strDataJson, "Zone","","", 0, "","存储量重置","存储量重置申请","",0 ) lua.Debug( strLuaDEID, debug.getinfo(1), "addSysWFP.nRet", nRet ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end end